#include <map>
#include <vector>
#include <string>

using namespace std;

void set_begin_id_number(unsigned int&);
unsigned int get_id_number(void);
unsigned int get_id_number_art(void);

class Article;
class NewsGroup {

	public:
	NewsGroup(string& name);
	NewsGroup(string& n_name, unsigned int&, unsigned int&); 
	~NewsGroup();	
	/* these functions return true if success else false */
	bool add_article(string& title, string& text, string& author); 
	void add_article(unsigned int&, string&, string&, string&);
	bool delete_article(unsigned int& art_id);	
	bool get_article(Article** dest, unsigned int& art_id); 	
	unsigned int get_art_id_count(void);

	map<unsigned int, Article*>::iterator begin();	
	map<unsigned int, Article*>::iterator end();	
	unsigned int get_id();
	string get_title();
	int size();

	private:
	unsigned int 			id; 	
	string				name; 
	map<unsigned int, Article*>	articles;	
	unsigned int			art_id;
};
/* Use this to compare each newsgroup with title_name */
class EqPred {	
	public:
	EqPred(const string& title_name): name(title_name) { }
	bool operator()(const pair<unsigned int, NewsGroup*>& ng)
	{
		return ng.second->get_title() == name;
	}
	private:
		string name;
};

class Article {
	public:
	Article();
	Article(
		string& , 
		string& ,
		string& 
	); 

	string 		title; 	/* title of article */
	string		author;
	string 		text;	/* text of article */
};
